
<!DOCTYPE html>
<html lang="en">
<head>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <title>订单审核</title>
    <link rel="stylesheet" href="__CSS__/bootstrap.min.css">
    <link rel="stylesheet" href="__CSS__/hdw.css">
    <link rel="stylesheet" href="__CSS__/reset.css">
    <link rel="stylesheet" href="__CSS__/common.css">
    <link rel="stylesheet" href="__CSS__/wechat/cons.css">
    <link rel="stylesheet" type="text/css" href="__CSS__/mobiscroll.custom-2.5.2.min.css">
    <link rel="stylesheet" href="__CSS__/wechat/view.css" />
    <script src="__JS__/vue.js"></script>
    <script src="__JS__/libs/jquery-2.0.2.min.js"></script>
    <script src="__JS__/bootstrap/bootstrap.min.js"></script>
    <script src="__JS__/hdw.js"></script>
    <script src="__JS__/mobiscroll.custom-2.5.2.min.js""></script>    
</head>
<body >	
	<div id="all">	
		<div class="black_bg" v-if="black_bg">
			<div class="sub_max">
				<div class="sub_con">
					<div v-for="(list,index) in lists">
						<div class="p_div" v-if="type1">
							<label for="">{{name1}}</label>
						<!--	<input type="text" class="P_input" v-bind="list.id"/>-->
							<select name="" style="padding:0;margin: 0;width: 100%;height: 28px;" v-model="list.id" class="test_3"></select>
						</div>
						<div class="m_div">
							<label for="">备注</label>
							<textarea name="" rows="" cols="" class="m_textare" v-model="list.note"></textarea>
						</div>
						<div style="height: 30px;width: 96%;" v-if="type1">
							<button class="remove" style="padding:1px 3px;float: right;" @click="remove(index)">删除</button>
						</div>
					</div>								
					<div class="b_div">
						<button class="addP" v-if="type1" @click="addp(lists)">添加{{name1}}</button>					
						<button @click="close" class="btn_back">取消</button>
						<button class="btn_sub" @click="btnsub(typeval)">提交</button>
					</div>
				</div>				
			</div>
			
		</div>		
		<div id="contentBox">
		    <nav class="navBox">
		        <span>订单审核</span>        
		    </nav>
		    <div class="mainContent">
				<div class="outer One" >			
					<div class="right">
						<p>基本情况</p>	
						<div class="line">
							<div class="lineleft">
								<span>申请人</span>
								<span>{{create.name}}</span>						
							</div>
						</div>
						<div class="line">
							<div class="lineleft">
								<span>申请人职务</span>
								<span>{{create.duty}}</span>
							</div>	
						</div>	
						<div class="line">
							<div class="lineleft">
								<span>负责人</span>
								<span>{{charge.name}}</span>						
							</div>
						</div>
						<div class="line">
							<div class="lineleft">
								<span>负责人职务</span>
								<span>{{charge.duty}}</span>
							</div>	
						</div>
						<div class="line">
							<div class="lineleft">
								<span>时间</span>
								<span>{{order.time | timetrans(1)}}</span>
							</div>	
						</div>
					</div>
				</div>
				<div class="outer One">			
					<div class="right">
						<p>详情</p>	
						<div class="showtwo">
							<div class="line">
								<div class="lineleft">
									<span>项目名称</span>
									<span>{{order.name}}</span>						
								</div>
							</div>
							
							<div class="line">
								<div class="lineright">
									<span>金额</span>
									<span>￥{{order.acamount}}</span>
								</div>
							</div>
							<div class="line">
								<div class="lineright">
									<span>周期</span>
									<span>{{order.cycles}}</span>
								</div>
							</div>
							<div class="line">
								<div class="lineright" style="height: 41vw;">
									<span>合同</span>
									<img class="contract" :src="order.url" alt="" @click="showBigimg"/>
								</div>
							</div>
							<div class="line">
								<div class="lineright">
									<span>详细描述</span>
									<span>{{order.content}}</span>
								</div>
							</div>
							<div class="line">
								<div class="lineright">
									<span>备注</span>
									<span>{{order.remarks}}</span>
								</div>
							</div>
						</div>						
					</div>
				</div>
				<div class="outer One">			
					<div class="right">
						<p>操作</p>			
						<div class="line">
							<div class="lineright" style="padding: 5px 0;">
								<span @click="open(1)" style="width: 50%;"><button style="width: 80%;">重修</button></span>
								<span @click="open(2)" style="width: 50%;"><button style="width: 80%;float: right;">返修</button></span>
							</div>
						</div>						
						<div class="line">
							<div class="lineright" style="padding: 5px 0;">
								<span @click="open(3)" style="width: 50%;"><button style="width: 80%;">征询</button></span>
								<span @click="open(4)" style="width: 50%;"><button style="width: 80%;float: right;">抄送</button></span>
							</div>
						</div>
						
					</div>
				</div>
				<div class="outer three">			
					<div class="right">
						<p>审核</p>						
						<div class="line">
							<div class="lineright">
								<span>结果:(默认通过、蓝色)</span>
								<span><button :class="{'choosed':isMe}" style="margin-right: 18px;padding:0px 8px;" @click="isleft(1)">通过</button><button style="padding:0px 8px;" :class="{'choosed':!isMe}" @click="isleft(2)">不通过</button></span>
							</div>				
						</div>							
						<div class="line">
							<div class="lineright">
								<span style="width: 15%;">意见：</span>
								<textarea name="" style="width: 80%;height: 60px;margin-left: 5%;" class="notesss"></textarea>
							</div>				
						</div>
											
					</div>
				</div>
				<button class="submit1">提交</div>
		    </div>
		</div>
	</div>
<script src="__JS__/layer/layer.js"></script>	
<script>
	 var str=location.href;
	var str=str.split("id/")[1];
	var ids=str.split(".html")[0];
	var isOk=1;
	var notesss=$(".notesss").val();
	$(window).load(function(){
		$(".submit1").click(function() {
			var notesss = $(".notesss").val();
			$.ajax({
				type: "post",
				url: "{{:url('manage/Affairorder/processAffair')}}",
				data: {
					id: ids,
					action: "chief",
					result: isOk,
					note: notesss
				},
				success: function(data) {
					var data = JSON.parse(data);
					if(data.status == 1) {
						layer.msg("提交成功！")
					} else {
						layer.msg(data.message);
					}
				}
			})
		});	
	})
	

	Vue.filter("timetrans",function(date,type){
        var date = new Date(date*1000);//如果date为10位不需要乘1000
        var Y = date.getFullYear();
        var M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1);
        var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
        var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours());
        var m = (date.getMinutes() <10 ? '0' + date.getMinutes() : date.getMinutes());
        var s = (date.getSeconds() <10 ? '0' + date.getSeconds() : date.getSeconds());        
        if(type==1){
          return Y+"/"+M+"/"+D+" "+h+":"+m+":"+s;
        }else if(type==2){
          return Y+"/"+M+"/"+D;
        } else if(type==3){
          return M+"/"+D+" "+h+":"+m;
        }     
      });
         
    var vm = new Vue({
        el:"#all",
        data:{
    		showone:true,
    		showtwo:false,
    		showthree:false,
        	show:false,
        	base:[],
        	charge:[],
        	create:[],
        	goods:[],
        	order:[],
        	jury:[],
        	result:"",
        	noteshow:true,
        	juryMan:[],
        	black_bg:false,
        	type1:false,
        	typeval:1,
        	lists:[
        	{id:"",note:""},
        	],
        	name1:"咨询对象",
        	isMe:true,
        },
        methods:{
        	showBigimg(){
          		this.show=true;         		
          	
          	},
          	quit(){
          		this.show=false;
				console.log(this.show);   
          	},
          	showonepart(e){          	
          		this.showone=!this.showone;
          		$(e.target).find("img").toggleClass("rotate");
          	},
          	showtwopart(e){
          		this.showtwo=!this.showtwo;
          		$(e.target).find("img").toggleClass("rotate");
          	},
          	showthreepart(e){
          		this.showthree=!this.showthree;
          		$(e.target).find("img").toggleClass("rotate");
          	},
          	rotate(e){
          		$(e.target).toggleClass("rotate");
          	},
        	//关闭
        	close:function(){
        		this.lists[0].note="";
        		this.lists.splice(1, 6);
        		this.black_bg=false;					
        	},
        	isleft:function(data){
        		if(data==1){
        			this.isMe=true;
        			isOk=1;
        		}else{
        			isOk=0;
        			this.isMe=false;
        		}
        	},

        	//增加
        	addp:function(lists){       		
        		var attra={id:"",note:""};
        		this.lists.push(attra);
        		$.ajax({
					type: "post",
					url: "{{:url('manage/Order/getresponseinfo')}}",
					data: {
						type: "0",				
					},
					success: function(data) {
						var data = JSON.parse(data);
						var data = data.data;
						var len = data.length;
						for(var i = 0; i < len; i++) {
							var options = `
		    				<option value="${data[i].uid}" class="option3" onclick="addtext()" imgPath="https://select2.github.io/vendor/images/flags/ak.png">${data[i].name}+${data[i].rname}</option>        			
		    			`;
							$(".test_3").append($(options));
						}
						for(var i = 0; i < len; i++) {
							var options = `
		    				<option value="${data[i].uid}" class="option4" imgPath="https://select2.github.io/vendor/images/flags/ak.png">${data[i].name}+${data[i].rname}</option>        			
		    			`;
							$(".test_4").append($(options));
						}
					}
				})
        	},
        	//移除
        	remove:function(index){
        		this.lists.splice(index, 1);
        	},
        	//btn 点击
          	open:function(data){
          		this.typeval=data;
          		this.black_bg=true;
          		if(data==4||data==3){
          			$.ajax({
					type: "post",
					url: "{{:url('manage/Order/getresponseinfo')}}",
					data: {
						type: "0",
					},
					success: function(data) {
						var data = JSON.parse(data);
						var data = data.data;
						var len = data.length;
						for(var i = 0; i < len; i++) {
							var options = `
		    				<option value="${data[i].uid}" class="option3" onclick="addtext()" imgPath="https://select2.github.io/vendor/images/flags/ak.png">${data[i].name}+${data[i].rname}</option>        			
		    			`;
							$(".test_3").append($(options));
						}
						for(var i = 0; i < len; i++) {
							var options = `
		    				<option value="${data[i].uid}" class="option4" imgPath="https://select2.github.io/vendor/images/flags/ak.png">${data[i].name}+${data[i].rname}</option>        			
		    			`;
							$(".test_4").append($(options));
						}
					}
				})
          		}
          		if(data==4){
          			this.name1="抄送对象";
          			this.type1=true;
          		}else if(data==3){
          			this.name1="咨询对象";
          			this.type1=true;
          		}else if(data==2){
          			this.type1=false;
          		}else if(data==1){
          			this.type1=false;
          		}
          	},
          	btnsub:function(data){
          		var urlT="{{:url('manage/Affairengineering/processAffair')}}";
          		var note=this.lists[0].note;
          		var injueryId=this.lists;
          	//重修
          		if(data==1){
          			var data={
          				id:ids,
          				note:note,
          				action:"rework"
          			};
          	//返修		
          		}else if(data==2){          			
          			var data={
          				id:ids,
          				note:note,
          				action:"modify"
          			};
          	//		
          		}else if(data==3){
          			var data={
          				id:ids,
          				injueryId: injueryId,
          				action:"inquiry"
          			};
          		}
          		else if(data==4){
          			
          			var data={
          				id:ids,
          				action:"copy",
          				injueryId: injueryId
          			};
          		}
          		$.ajax({
          			type:"post",
          			url:urlT,
          			data:data,
          			success:function(data){
          				var data=JSON.parse(data);
          				if(data.status==1){
          					alert("提交成功！");
          				}else{
          					alert(data.message);
          				}
          			}
          		});
          	}
        },
        created(){        	
        	var _this=this;
        	$.ajax({
        		type:"post",
        		data:{
        			id:ids
        		},
        		url:"{{:url('manage/Affairengineering/orderDetailData')}}",
        		success:function(data){
        			var data=JSON.parse(data);
        			var data=data.data;
        			_this.base=data.base;
        			_this.charge=_this.base.charge;
        			_this.create=_this.base.create;
        			_this.jury=data.jury;
        			//y
        			var order=data.order;
        			console.log(data)
        			_this.order=order;
        			_this.goods=order.goods;
        			if(_this.jury.type==-1){
        				_this.result="处理中";
        				_this.noteshow=false;
        			}else if(_this.jury.type==0){
        				_this.result="未通过";
        			}else if(_this.jury.type==1){
        				_this.result="通过";
        			}        			       			        			
        		}
        	})
      	},
       
    })   
</script>
</body>
</html>


